/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commands;

import edu.wpi.first.wpilibj.command.PIDCommand;

/**
 *
 * @author David
 */
public class LeftBrake extends PIDCommand {
    
    private static final double setpoint = 36.0;
    
    public LeftBrake(double p,double i,double d) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        
        super(p,i,d);
        requires(CommandBase.drivetrain);
        
    }
    

    
    public void usePIDOutput(double val){
      
        CommandBase.drivetrain.setLeft(val);
        
    }
    
    
    public double returnPIDInput(){
        return CommandBase.drivetrain.getLeftEncoder().getDistance();
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        CommandBase.drivetrain.getLeftEncoder().setDistancePerPulse(0.03222146311374146911243736803364);
        setSetpoint(setpoint);
        getPIDController().setOutputRange(-0.5, 0.5);
        CommandBase.drivetrain.getLeftEncoder().start();
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        //System.out.println("TOTAL DISTANCE TRAVELED: " + getPosition() + " IN.");
        
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}
